#!/usr/bin/php
<?php
   /**
    * Advert Cron processes.
    * Any questions 2 : romanshneer@gmail.com
    **/

#mysql_connect("localhost","root","marduk");
#mysql_select_db("infopark_com_ua");

define('DRUPAL_ROOT', getcwd());

include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

/* DELETE OLD ADVERTS */
$sql1="SELECT DISTINCT n.nid 
FROM node n
LEFT JOIN node_advert na ON na.nid=n.nid
LEFT JOIN node_advert_dates nad ON nad.nid=n.nid
WHERE n.type='advert' AND nad.public_date<'".strtotime("-3 months")."'";

$n_rec=db_query($sql1);
while($n=$n_rec->fetchObject())
  {
    pre($n);
  }
/*DELETE GABIGE DB :: UNUSABLE fields adverts and more */
?>